
#include"Solider.h"
#include"Gun.h"

void test()
{
    Solider zhangsan_("张三");
    zhangsan_.addGun(new Gun{"AK47"});
    int bullet_num_ = 0;
    bool bullet_judge = true;
    
    while(bullet_judge)
    {   
        std::cout<<"请输入需要装载的子弹数量(0<number<30):"<<std::endl;
        std::cin>>bullet_num_;
        (bullet_num_<=0 || bullet_num_>30)?bullet_judge = true:bullet_judge = false;
    }
    
    zhangsan_.addBulletToGun(bullet_num_);
    if(zhangsan_.fire())
    {
        std::cout<<"开火成功!"<<std::endl;
    }

}

int main(int argc, char const *argv[])
{
    //int a = 0;
    std::cout<<"1"<<std::endl;
    std::cout<<"1"<<std::endl;
     test();
    return 0;
}